﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using KTXD.Entities;
using KTXD.Data;
using System.Web.UI.WebControls;
using System.Data;

/// <summary>
/// Summary description for BindCatalog
/// </summary>
public class BindCatalog
{
	public BindCatalog()
	{
		//
		// TODO: Add constructor logic here
		//
	}

    public static void BindBoSuuTap(DropDownList cboCatalog)
    {
        TList<BoSuuTap> TList_Catalog = DataRepository.BoSuuTapProvider.Find("TrangThai=True");
        cboCatalog.DataSource = TList_Catalog;
        cboCatalog.DataTextField = "Ten";
        cboCatalog.DataValueField = "Id";
        cboCatalog.DataBind();
        ListItem ItemChoose = new ListItem();
        ItemChoose.Text = " -- Bộ sưu tập --";
        ItemChoose.Value = "0";
        cboCatalog.Items.Insert(0, ItemChoose);
    }

    public static void BindMenu(DropDownList cboCatalog)
    {
        TList<MenuTop> TList_Catalog = DataRepository.MenuTopProvider.GetAll();
        cboCatalog.DataSource = TList_Catalog;
        cboCatalog.DataTextField = "TenMenu";
        cboCatalog.DataValueField = "Id";
        cboCatalog.DataBind();
        ListItem ItemChoose = new ListItem();
        ItemChoose.Text = " -- Tên Menu --";
        ItemChoose.Value = "0";
        cboCatalog.Items.Insert(0, ItemChoose);
    }

    public static void BindLoaiChuyenMuc(DropDownList cboCatalog)
    {
        TList<LoaiChuyenMuc> TList_Catalog = DataRepository.LoaiChuyenMucProvider.GetAll();
        cboCatalog.DataSource = TList_Catalog;
        cboCatalog.DataTextField = "TenLoaiChuyenMuc";
        cboCatalog.DataValueField = "Id";
        cboCatalog.DataBind();
        ListItem ItemChoose = new ListItem();
        ItemChoose.Text = " -- Tên Loại Chuyên Mục --";
        ItemChoose.Value = "0";
        cboCatalog.Items.Insert(0, ItemChoose);
    }

    public static void BindSubChuyenMuc(DropDownList cboCatalog)
    {
        TList<SubChuyenMuc> TList_Catalog = DataRepository.SubChuyenMucProvider.GetAll();
        cboCatalog.DataSource = TList_Catalog;
        cboCatalog.DataTextField = "TenSubChuyenMuc";
        cboCatalog.DataValueField = "Id";
        cboCatalog.DataBind();
        ListItem ItemChoose = new ListItem();
        ItemChoose.Text = " -- Tên Sub Chuyên Mục --";
        ItemChoose.Value = "0";
        cboCatalog.Items.Insert(0, ItemChoose);
    }

    public static void BindTacGia(DropDownList cboCatalog)
    {
        TList<ThanhVien> TList_Catalog = DataRepository.ThanhVienProvider.GetAll();
        cboCatalog.DataSource = TList_Catalog;
        cboCatalog.DataTextField = "HoTen";
        cboCatalog.DataValueField = "Id";
        cboCatalog.DataBind();
        ListItem ItemChoose = new ListItem();
        ItemChoose.Text = " -- Tác giả --";
        ItemChoose.Value = "0";
        cboCatalog.Items.Insert(0, ItemChoose);
    }
}